﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Medianamik.Core;
using Medianamik.Core.Querying;
using Medianamik.UI.Controls;
using Telerik.Web.UI;

namespace Medianamik.UI.Web.Forum
{
    public partial class ForumConfigurationList : BaseModuleListPage
    {
        #region Fields


        #endregion

        #region Events

        protected override void GridNeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
            Grid.DataSource = new Query()
                .Where(n => n.ParentID, Comparison.Equal, ParentNodeId ?? RootNodeId)
                .Where(n => n.NodeTypeID, Comparison.Equal, ForumTypes.ForumConfiguration)
                .Execute();
        }

        #endregion

        #region Properties

        protected override Guid RootNodeId
        {
            get { return MedianamikModules.ForumManagement; }
        }

        protected override RadGrid Grid
        {
            get { return ForumConfigGrid; }
        }

        protected override UpdatePanel GridUpdatePanel
        {
            get { return ForumUpdatePanel; }
        }

        protected override string ManagementURL
        {
            get { return "forumconfigurationmanagement.aspx"; }
        }

        protected override GridOptions GridOptions
        {
            get
            {
                return GridOptions.Name;
            }
        }

        protected override BreadcrumbTrail BreadcrumbTrail
        {
            get { return Breadcrumbs; }
        }

        #endregion

        #region Methods

        protected override void Navigate()
        {
            base.Navigate();
            Grid.Rebind();
            ForumUpdatePanel.Update();
        }

        #endregion
    }
}
